<script setup>
import { message } from "ant-design-vue";
import { ref } from "vue";
import { setServerTitle } from "@/api/server";
const emit = defineEmits(["finished"]);

const serverId = ref(-1);
const visible = ref(false);
const value = ref("普通");

const init = (id) => {
  serverId.value = id;
  visible.value = true;
};
const handleOk = async () => {
  let { data } = await setServerTitle(serverId.value, value.value);
  message.info(data.message);
  visible.value = false;
  emit("finished");
};

defineExpose({ init });
</script>

<template>
  <a-modal title="修改头衔" v-model:visible="visible" @ok="handleOk">
    服务器ID: {{ serverId }} <br /><br />
    <a-select ref="select" v-model:value="value">
      <a-select-option value="普通">普通</a-select-option>
      <a-select-option value="推荐">推荐</a-select-option>
      <a-select-option value="原创">原创</a-select-option>
      <a-select-option value="人气">人气</a-select-option>
    </a-select>
  </a-modal>
</template>
